#include "chassis.h"


void Chassis::setId(string _id)
{
    id=_id;
} 

void Chassis::setModel(string _model)
{
    model=_model;
}

void Chassis::setWheelbase(int w )
{
    wheelbase=w;
}

void Chassis::setTrack_width(int t)
{
    track_width=t;
}

void Chassis::setMinimum_ground_clearance(int m_g)
{
    minimum_ground_clearance=m_g;
}

void Chassis::setMinimum_turning_radius(int m_t)
{
    minimum_turning_radius=m_t;
}


void Chassis::setDriving_form(string form)
{
    driving_form=form;
}

void Chassis::setMaximum_stroke(int max)
{
    maximum_stroke=max;
}

void Chassis::setT1(Tire _t1)
{
    t1=_t1;
}

void Chassis::setT2(Tire _t2)
{
    t2=_t2;
}

void Chassis::setT3(Tire _t3)
{
    t3=_t3;
}

void Chassis::setT4(Tire _t4)
{
    t4=_t4;
}

void Chassis::print ()
{
    cout<< "底盘"<<endl<<"a.编号："<< id<<endl<< "b.型号：" <<model<<endl
    << "c.轴距：" <<wheelbase<<"mm"<<endl<< "d.轮距："<< track_width<<"mm"<<endl
    << "e.最小离地间隙:"<<minimum_ground_clearance<< "mm"<<endl<<"f:最小转弯半径："<< minimum_turning_radius<<"m"<<endl
    << "g.驱动形式："<<driving_form<<endl<< "h.最大行程："<< maximum_stroke<<endl;
    t1.print();
    t2.print();
    t3.print();
    t4.print();
}


void Chassis::save (string path)
{
    ofstream ofs;// 创建流对象
    ofs.open(path, ios::out | ios::app);

    ofs<< "底盘"<<endl<<"a.编号："<< id<<endl<< "b.型号：" <<model<<endl
    << "c.轴距：" <<wheelbase<<"mm"<<endl<< "d.轮距："<< track_width<<"mm"<<endl
    << "e.最小离地间隙:"<<minimum_ground_clearance<< "mm"<<endl<<"f:最小转弯半径："<< minimum_turning_radius<<"m"<<endl
    << "g.驱动形式："<<driving_form<<endl<< "h.最大行程："<< maximum_stroke<<endl;
    
    t1.save(path);
    t2.save(path);
    t3.save(path);
    t4.save(path);

    ofs.close();
}

